<template>
  <router-view v-if="shouldShowRouterView" />
  <AppLayout v-else />
</template>

<script setup>
import { computed } from 'vue'
import { useRoute } from 'vue-router'
import AppLayout from './components/AppLayout.vue'

const route = useRoute()

// 需要直接显示router-view的路由
const directRoutes = ['login', 'admin']
const shouldShowRouterView = computed(() => {
  return directRoutes.includes(route.name)
})
</script>

<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  width: 100vw;
  margin: 0;
  padding: 0;
}

#app {
  min-height: 100vh;
  width: 100vw;
  overflow-x: auto;
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
  background: #3a3a3a;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #4a4a4a;
}

/* 强制所有Element Plus容器使用全宽 */
.el-container,
.el-main,
.el-aside,
.el-header,
.el-footer {
  width: 100% !important;
  max-width: none !important;
}

/* 确保所有页面容器都使用全宽 */
.home,
.category,
.detail,
.player,
.user,
.search,
.video-center,
.user-profile,
.login-container {
  width: 100vw !important;
  max-width: none !important;
}

/* 保护Swiper组件不受全局样式影响 */
.swiper-container,
.swiper-wrapper,
.swiper-slide {
  width: 100% !important;
  height: 100% !important;
}

.swiper-slide {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
</style>
